package entity;

import org.hibernate.annotations.*;
import org.hibernate.annotations.Cache;

import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by wsx on 2017/5/13.
 */
@Entity
@Table(name = "cro_changegoods")
@DynamicInsert(true)
//@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class CroChangegoods implements Serializable {
    private String id;
    private CroPurchase croPurchase;
    private CroPurgoods croPurgoods;
    private  CroPurgoods changeCroPurgoods;
    private String goodsnumber;
    private String changegoodsnumber;
    private String changereson;
    private String change_status;
    private String del_flag;
    private Date applydate;
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @ManyToOne(cascade ={CascadeType.REFRESH},fetch =FetchType.EAGER)
    @JoinColumn(name ="purchaseid",referencedColumnName = "id")
    public CroPurchase getCroPurchase() {
        return croPurchase;
    }

    public void setCroPurchase(CroPurchase croPurchase) {
        this.croPurchase = croPurchase;
    }
    @ManyToOne(cascade ={CascadeType.REFRESH},fetch =FetchType.EAGER)
    @JoinColumn(name ="goodsid",referencedColumnName = "id")
    public CroPurgoods getCroPurgoods() {
        return croPurgoods;
    }

    public void setCroPurgoods(CroPurgoods croPurgoods) {
        this.croPurgoods = croPurgoods;
    }
    @ManyToOne(cascade ={CascadeType.REFRESH},fetch =FetchType.EAGER)
    @JoinColumn(name ="changegoodid",referencedColumnName = "id")
    public CroPurgoods getChangeCroPurgoods() {
        return changeCroPurgoods;
    }

    public void setChangeCroPurgoods(CroPurgoods changeCroPurgoods) {
        this.changeCroPurgoods = changeCroPurgoods;
    }

    public String getGoodsnumber() {
        return goodsnumber;
    }

    public void setGoodsnumber(String goodsnumber) {
        this.goodsnumber = goodsnumber;
    }

    public String getChangereson() {
        return changereson;
    }

    public void setChangereson(String changereson) {
        this.changereson = changereson;
    }

    public String getChange_status() {
        return change_status;
    }

    public void setChange_status(String change_status) {
        this.change_status = change_status;
    }

    public String getDel_flag() {
        return del_flag;
    }

    public void setDel_flag(String del_flag) {
        this.del_flag = del_flag;
    }

    @CreationTimestamp
    public Date getApplydate() {
        return applydate;
    }

    public void setApplydate(Date applydate) {
        this.applydate = applydate;
    }

    public String getChangegoodsnumber() {
        return changegoodsnumber;
    }

    public void setChangegoodsnumber(String changegoodsnumber) {
        this.changegoodsnumber = changegoodsnumber;
    }
}
